package com.pj.common.utils

import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import com.qmuiteam.qmui.widget.pullLayout.QMUIPullLayout


fun AppCompatActivity.setupToolbar(toolbar: Toolbar, back: Boolean = true) {
    setSupportActionBar(toolbar)
    if (back) {
        toolbar.setNavigationOnClickListener { onBackPressed() }
        supportActionBar?.run {
            setDisplayHomeAsUpEnabled(true)
            setDisplayShowTitleEnabled(true)
        }
    }
}


fun QMUIPullLayout.noMore(isNoMore: Boolean) {
    if (isNoMore)
        setEnabledEdges(QMUIPullLayout.PULL_EDGE_TOP)
    else
        setEnabledEdges(QMUIPullLayout.PULL_EDGE_TOP and QMUIPullLayout.PULL_EDGE_BOTTOM)
}





